package com.app.service.user

import com.app.mapper.TUserMapper
import com.app.model.TUser
import com.app.service.BaseService
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

/**
 * Created with IntelliJ IDEA.
 * com.myTest.service
 * User: 王利平
 */
@CompileStatic
@TypeChecked
@Service
class UserService extends BaseService<TUser> implements IUserService{

    @Autowired
    void setMapper(TUserMapper mapper) {
        super.baseMapper = mapper;
    }

    @Override
    @Transactional
    Long addBasic(TUser  obj ) throws Exception {
        baseMapper.insert(obj);
        return obj.id;
    }

    @Override
    @Transactional
    void modifyBasic(TUser  obj) throws Exception {
        baseMapper.updateByPrimaryKeySelective(obj);
    }

    @Override
    @Transactional
    void delBasic(TUser  obj) throws Exception {
        baseMapper.deleteByPrimaryKey((obj).getId())
    }

}
